<?php
    $result = mysqli_connect('localhost','root','root');
    if(!$result){
        echo "数据库连接失败";
    }
    mysqli_query($result,"set names 'utf8'");
    $select_db = mysqli_select_db($result,"report");
    if(!$select_db){
        echo "不能连接到此数据库:\n".mysqli_error();
    }
    
    if(!empty($_POST['submit'])){
        $event = $_POST['event'];
        $content = $_POST['content'];
        $analysis = $_POST['analysis'];
        $sql = "insert into po_report(event,content,analysis,addtime) values('".$event."','".$content."','".$analysis."',".time().")";
    }
    $re = mysqli_query($result,$sql);
    if($re){
        echo "<script>alert('报告上传成功');location.href='report.php';</script>";
    }else{
        echo "<script>alert('报告上传失败');location.href='report.php';</script>";
    }
?>